# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-archiveis
pkgname=('python2-archiveis' 'python-archiveis')
_pkgname=archiveis
pkgver=0.0.9
pkgrel=6
pkgdesc='A simple Python wrapper for the archive.is capturing service.'
arch=('any')
url='https://pypi.org/project/archiveis/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('bdb7642df1a26663515f2d16acecf01b3446b6b96682f5a485a612febe8aae78856070b7b073b3dc96100e3ed8580d04697e080ef8fe020b0e513fed59385ccf')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-archiveis() {
  depends=('python2' 'python2-click' 'python2-requests' 'python2-six')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-archiveis() {
  depends=('python' 'python-click' 'python-requests' 'python-six')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

